<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>评论-闲言轻博客</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	{{template "/comn/link.html"}}
</head>
<body class="lay-blog">
{{template "/comn/header.html" .}}
		<div class="container-wrap">
			<div class="container container-message container-details">
					<div class="contar-wrap">
						<div class="item">
							<div class="item-box  layer-photos-demo1 layer-photos-demo">
								{{template "comn/note.html" .note}}
								<div class="count layui-clear">
									<span class="pull-left">阅读 <em>100000+</em></span>
									<span class="pull-right like" data-type="note" data-key="{{.note.Key}}">
										<i class="layui-icon layui-icon-praise"></i><em class="value">{{.note.Praise}}</em></span>
								</div>
							</div>
						</div>	
						<a name="comment"> </a>
						<div class="comt layui-clear">
							<a href="javascript:;" class="pull-left">评论</a>
							<a href="/comment/{{.note.Key}}" class="pull-right">写评论</a>
						</div>
						<div id="LAY-msg-box">
							{{range .message}}
							<div class="info-item">
								<img class="info-img" src="/static/images/info-img.png" alt="">
								<div class="info-text">
									<p class="title count">
										<span class="name">{{.User.Name}}</span>
										<span class="info-img like" data-type="message" data-key="{{.Key}}">
											<i class="layui-icon layui-icon-praise"></i>
											<span class="value">{{.Praise}}</span>
										</span>
									</p>
									<p class="info-intr">{{.Content}}</p>
								</div>
							</div>
							{{end}}
						</div>
					</div>
			</div>
		</div>
{{template "comn/footer.html"}}
<script>
	var user ={{.User}}
	var message ={{.message}}
	var noteu ={userid:{{.note.UserID}},key:{{.note.Key}}}
	layui.use(["util","jquery"],function () {
		var util=layui.util
			,$=layui.jquery;
		if(user&&user.role==0&&user.id>0&&user.id==noteu.userid){
			util.fixbar({
				bar1:'&#xe642',
				bar2:'&#xe640',
				click:function (type) {
					if(type=='bar1'){
						window.location.href='/note/edit/'+noteu.key
					}
					if(type=='bar2'){
						$.post("/note/del/"+noteu.key,function (data) {
							if(data.code==0){
								layer.msg('删除成功');
								if(data.action){
									setTimeout(function () {
										window.location.href=data.action
									},300)
								}
							}else{
								layer.msg('删除失败');
							}
						},"json").error(function () {
							layer.msg('网络延迟');
						})
					}
				}
			})
		}
	})
</script>
</body>
</html>